<template>
	<view :style="{ 'background-image': `linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.8) 40%),url(${store.mer_banner})` }"
	 class="store-home">
		<!-- 搜索 -->
		<!-- #ifdef H5 -->
		<view class="header" v-show="tabActive === 1">
			<view class="head-menu">
				<view class="iconfont icon-xiangzuo" @click="goback"></view>
				<view class="iconfont icon-shouye4" @click="goHome"></view>
			</view>
			<navigator :url="'/pages/store/list/index?mer_id='+id" hover-class="none" class="search"><text class="iconfont icon-xiazai5"></text>搜索商品</navigator>
		</view>
		<!-- #endif-->
		<scroll-view class="main" scroll-y="true" @scroll="scrollHome">
			<view class="u-swiper" v-show="tabActive === 0">
				<u-swiper :list="list" height="600"></u-swiper>
			</view>
			<view id="guarantee" class="guarantee" v-show="tabActive === 0">
				<view class="item">
					<image src="/static/images/shop_icon1.png" mode=""></image>
					<view class="text">正品溯源</view>
				</view>
				<view class="item">
					<image src="/static/images/shop_icon2.png" mode=""></image>
					<view class="text">假一赔十</view>
				</view>
				<view class="item">
					<image src="/static/images/shop_icon3.png" mode=""></image>
					<view class="text">产地直邮</view>
				</view>
			</view>
			<view v-show="tabActive === 0" class="" style="background-color: #F5F5F5;height: 20rpx;">
			</view>
			<view class="recommend" v-show="tabActive === 0">
				<view class="top">
					<view class="title">热卖推荐</view>
					<view class="subtitle"> 
						<span></span>
						<text>HOT SALES</text>
						<span></span>
					</view>
				</view>
				<view class="recommend-goods">
					<view class="item" v-for="(item, index) in store.recommend" :key="index" @click="goGoodsDetail(item.product_id)">
						<image :src="item.image" mode=""></image>
						<view class="name">{{ item.store_name }}</view>
						<view class="price">{{ item.price }}</view>
					</view>
				</view>
			</view>
			<view class="" style="background-color: #F5F5F5;height: 20rpx;">
			</view>
			<view class="recommend" v-show="tabActive === 0">
				<view class="top">
					<view class="title">优选好货</view>
					<view class="subtitle">
						<span></span>
						<text>RECOMMENDED GOODS</text>
						<span></span>
					</view>
				</view>
				<view class="recommend-goods">
					<view class="item" v-for="(item, index) in store.optimal" :key="index" @click="goGoodsDetail(item.product_id)">
						<image :src="item.image" mode=""></image>
						<view class="name">{{ item.store_name }}</view>
						<view class="price">{{ item.price }}</view>
					</view>
				</view>
			</view>
			<view v-show="tabActive === 0" class="" style="background-color: #F5F5F5;height: 20rpx;">
			</view>
			<!-- 店铺信息 -->
			<view id="store" class="store" :class="tabActive==0?'fff':''">
				<image :src="store.mer_avatar"></image>
				<view class="text">
					<navigator :url="`/pages/store/detail/index?id=${id}`" hover-class="none">
						<text v-if="store.is_trader" class="font-bg-red">自营</text>
						<text class="name">{{ store.mer_name }}</text>
						<text class="iconfont icon-xiangyou"></text>
					</navigator>
					<view class="score">
						<view class="star">
							<view :style="{ width: `${score.star.toFixed(2)}%` }"></view>
						</view>
						<view>{{ score.number.toFixed(1) }}</view>
					</view>
				</view>
				<button  hover-class="none" :class="store.care ? 'care' : ''" v-if="!isLogin" @click="authOpen">
					<text v-show="!store.care" class="iconfont icon-guanzhu"></text>
					{{ store.care ? '已关注' : '关注' }}
				</button>
				<button  v-else hover-class="none" :class="store.care ? 'care' : ''" @click="followToggle">
					<text v-show="!store.care" class="iconfont icon-guanzhu"></text>
					{{ store.care ? '已关注' : '关注' }}
				</button>
			</view>
			<view v-show="tabActive === 0" class="" style="background-color: #F5F5F5;height: 20rpx;">
			</view>
			<view v-show="tabActive === 0" class="nav">
				<view class="nav-cont" :class="{ fff: navShow }">
					<view class="item" style="padding: 0 30rpx;">
						<navigator class="navigator" :class="{ fwfw: navShow }" :url="'/pages/list/index?mer_id=' + id" hover-class="none">
							<u-icon name="search" size="28"></u-icon>
							搜索
						</navigator>
					</view>
					<view :class="{ active: navActive === 0 }" class="item" @click="navActive = 0;select.show = !select.show">
						<view class="cont">
							{{ select.selected ? '评分' : '默认' }}
						</view>
					</view>
					<view :class="{ active: navActive === 1 }" class="item" @click="set_where(2)">
						<view class="cont">
							销量
						</view>
					</view>
					<view :class="{ active: navActive === 2 }" class="item" @click="set_where(3)">
						<view class="cont">
							价格
							<image v-if="navActive === 2 && where.order == 'price_asc'" src="/static/images/up.png"></image>
							<image v-if="navActive === 2 && where.order == 'price_desc'" src="/static/images/down.png"></image>
						</view>
					</view>
					<view :class="{ active: navActive === 3 }" class="item" @click="set_where(4)">
						<view class="cont">
							新品
						</view>
					</view>
					<!-- <view :class="{ active: navActive === 5 }" class="item" @click="set_where(5)">
						<view class="cont">
							活动
						</view>
					</view> -->
					<view :class="{ active: navActive === 4 }" class="item" @click="select.show = false;navActive = 4;isColumn = !isColumn">
						<view class="cont">
							<text :class="['layout-icon', 'iconfont', isColumn ? 'icon-pailie' : 'icon-tupianpailie']"></text>
						</view>
					</view>
				</view>
			</view>
			<view class="tab-cont">
				<!-- 首页 -->
				<view v-show="tabActive === 0">
					<!-- 商品 -->
					<view class="goods-wrap">
						<view class="top">
							<view class="title">热卖推荐</view>
							<view class="subtitle">
								<span></span>
								<text>HOT SALES</text>
								<span></span>
							</view>
						</view>
						<view v-if="goods.length" :class="{ column: isColumn }" class="goods">
							<view v-for="item in goods" :key="item.product_id" class="item" @click="goGoodsDetail(item)">
								<view class="image">
									<image :src="item.image"></image>
								</view>
								<view class="text">
									<view class="name">
										<span v-if="item.product_type != 0" :class="'font_bg-red type'+item.product_type">{{item.product_type == 1 ? "秒杀" : item.product_type == 2 ? "预售" : item.product_type == 3 ? "助力" : item.product_type == 4 ? "拼团" : ""}}</span>
										{{ item.store_name }}
									</view>
									<view class="money-wrap">
										<view class="money">
											¥
											<text>{{ item.price }}</text>
										</view>
										<view class="ticket" v-if="item.issetCoupon">领券</view>
									</view>
									<view class="score">{{ item.rate }}评分 {{ item.reply_count }}条评论</view>
								</view>
								<view v-if="item.max_extension && (item.product_type == 0 || item.product_type == 2)" class="foot">
									<text v-show="!isColumn" class="iconfont"></text>
									最高赚 ¥{{ item.max_extension }}
								</view>
							</view>
						</view>
						<view :hidden="!goodsLoading" class="acea-row row-center-wrapper loadingicon">
							<text class="iconfont icon-jiazai loading"></text>
						</view>
						<emptyPage v-if="goods.length == 0 && !goodsLoading" title="暂无商品~"></emptyPage>
					</view>
				</view>
				<!-- 分类 -->
				<view v-show="tabActive === 1">
					<view class="category">
						<view class="section">
							<view class="head" @click="goCategoryGoods('')">
								<view class="title">全部</view>
								<view class="iconfont icon-xiangyou"></view>
							</view>
						</view>
						<view v-for="item in category" :key="item.store_category_id" class="section">
							<view class="head" @click="goCategoryGoods(item.store_category_id)">
								<view class="title">{{ item.cate_name }}</view>
								<view class="iconfont icon-xiangyou"></view>
							</view>
							<view v-if="item.children" class="body">
								<view v-for="value in item.children" :key="value.store_category_id" class="item" @click="goCategoryGoods(value.store_category_id)">{{ value.cate_name }}</view>
							</view>
						</view>
					</view>
					<view :hidden="!categoryLoading" class="acea-row row-center-wrapper loadingicon">
						<text class="iconfont icon-jiazai loading"></text>{{loadTitle}}
					</view>
				</view>
				<!-- 优惠券 -->
				<view v-show="tabActive === 2">
					<view v-if="coupon.length" class="coupon">
						<view v-for="item in coupon" :key="item.coupon_id" class="item">
							<view class="left" :class="{gary:item.issue}">
								<view class="money">
									¥
									<text>{{ item.coupon_price }}</text>
								</view>
								<view>满{{ item.use_min_price }}元可用</view>
							</view>
							<view class="right">
								<view class="name">
									<text :class="{gary:item.issue}">{{item.type===0?'店铺券':'商品券'}}</text>
									<!--购物满{{ item.use_min_price }}元可用-->
									{{ item.title }}
								</view>
								<view class="time-wrap" style="justify-content: space-between;">
									<block v-if="item.coupon_type == 1">
										<view class="time">{{ item.use_start_time | dateFormat }}-{{ item.use_end_time | dateFormat }}</view>
									</block>
									<block v-if="item.coupon_type == 0">
										<view>领取后{{ item.coupon_time}}天内可用</view>
									</block>
									<block v-if="item.issue">
										<view class="button gary">已领取</view>
									</block>
									<block v-else>
										<view class="button" @click="receiveCoupon(item)">立即领取</view>
									</block>
								</view>
							</view>
						</view>
					</view>
					<emptyPage v-if="coupon.length == 0" title="暂无优惠券~"></emptyPage>
				</view>
			</view>
		</scroll-view>
		<view class="footer">
			<view v-for="(item, index) in tabs" :key="index" :class="{ active: tabActive === index }" class="item" @click="tab(index)">
				<view :class="['iconfont', item.icon]"></view>
				<view>{{ item.name }}</view>
			</view>
		</view>
		<!-- #ifdef MP -->
		<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
		<!-- #endif -->
	</view>
</template>

<script>
	import request from "@/utils/request.js";
	import {
		getStoreDetail,
		getStoreGoods,
		getStoreCategory,
		followStore,
		unfollowStore
	} from '@/api/store.js';
	import {openBargainSubscribe} from '@/utils/SubscribeMessage.js';
	import {initiateAssistApi} from '@/api/activity.js';
	import {
		getShopCoupons,
		setCouponReceive,
	} from '@/api/api.js';
	import {
		getUserInfo
	} from '@/api/user.js';
	import {
		mapGetters
	} from "vuex";
	import {
		goShopDetail
	} from '@/libs/order.js';
	import {
		toLogin
	} from '@/libs/login.js';
	// #ifdef MP
	import authorize from '@/components/Authorize';
	// #endif
	import history from "@/mixins/history";
	import emptyPage from '@/components/emptyPage.vue'
	import shareScence from "@/libs/spread";
	const app = getApp();
	export default {
		components: {
			// #ifdef MP
			authorize,
			// #endif
			emptyPage
		},
		mixins: [history],
		filters: {
			dateFormat: function(value) {
				if (!value) {
					return '';
				}
				return value.split(' ')[0].replace('-', '.');
			}
		},
		data() {
			return {
				list: [
					{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				systemInfo: uni.getSystemInfoSync(),
				// #ifdef MP
				menuButtonInfo: uni.getMenuButtonBoundingClientRect(),
				// #endif
				id: 0, // 商铺id
				store: {}, // 商铺详情
				goods: [], // 商铺商品
				category: [], // 商铺分类
				coupon: [], // 优惠券
				isColumn: true, // 商品列表排列方式
				navShow: false,
				navActive: 0,
				tabActive: 0, // 底部切换
				keyword: '',
				order: '',
				sortPrice: true, // 价格排序
				goodsLoading: false,
				categoryLoading: false,
				loadTitle: '加载更多',
				isShowAuth: false, //是否隐藏授权
				isAuto: false, //没有授权的不会自动授权
				where: {
					order: '',
					keyword: '',
					page: 1,
					limit: 100
				},
				// 下拉菜单
				select: {
					show: false,
					selected: 0,
					options: [{
							id: 0,
							name: '默认'
						},
						{
							id: 1,
							name: '评分'
						}
					]
				},
				// 底部菜单
				tabs: [{
						icon: 'icon-yizhan_o',
						name: '首页'
					},
					{
						icon: 'icon-yingyongAPP_o',
						name: '分类'
					},
					{
						icon: 'icon-huobiliu_o',
						name: '领券'
					},
					{
						icon: 'icon-kefu_o',
						name: '联系客服'
					}
				],
				storeScroll: true,
				storeTop: 0,
				navHeight: 0,
				currSpid: ""
			}
		},
		computed: {
			score: function() {
				let store = this.store,
					score = {
						star: 0,
						number: 0
					};
				if ('postage_score' in store) {
					score.number = (parseFloat(store.postage_score) + parseFloat(store.product_score) + parseFloat(store.service_score)) /
						3;
					score.star = score.number / 5 * 100;
				}
				return score;
			},
			...mapGetters(['isLogin', 'uid']),
		},
		watch: {
			tabActive: function(value, old) {
				switch (value) {
					case 1:
						this.getCategory();
						break;
					case 2:
						this.getCoupon();
						break;
					case 3:
						this.tabActive = old
						let that = this;
						if (that.isLogin === false) {
							// #ifdef H5 || APP-PLUS
							toLogin();
							// #endif
							// #ifdef MP
							that.$set(that, 'isAuto', true);
							that.$set(that, 'isShowAuth', true);
							// #endif
						} else {
							uni.navigateTo({
								url: `/pages/chat/customer_list/chat?mer_id=${this.store.mer_id}&uid=${this.uid}`,
							});
						}
						break;
				}
			},
			order: function() {
				this.getGoods();
			}
		},
		onLoad: function(options) {
			console.log(this.isLogin)
			this.id = options.id;
			if (options.spid) {
				this.currSpid = options.spid
				app.globalData.spid = options.spid;
			}
			// #ifdef MP
			if (options.scene) {
				let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
				if (value.id) this.id = value.id;
				//记录推广人uid
				if (value.spid) {
					this.currSpid = value.spid
					app.globalData.spid = value.spid;
				}
			}
			// #endif
			shareScence(this.currSpid, this.isLogin)
			if (this.isLogin) {
				// #ifdef MP
				this.getHistory()
				// #endif
			}

		},
		onShow() {
			this.getStore();
			this.getGoods();
		},
		/**
		 * 用户点击右上角分享
		 */
		// #ifdef MP		
		onShareAppMessage: function() {
			wx.showShareMenu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline']
			})
			let that = this;
			return {
				title: that.store.mer_name || '',
				imageUrl: that.store.mer_avatar || '',
				path: '/pages/store/home/index?id=' + that.id + '&spid=' + that.uid,
			}
		},
		onShareTimeline: function() {
			let that = this;
			return {
				title: that.store.mer_name || '',
				query: {
					id: that.id,
					spid: that.uid
				},
				imageUrl: that.store.mer_avatar || ''
			}
		},
		// #endif
		mounted: function() {
			const query = uni.createSelectorQuery().in(this);
			query.select('#guarantee').boundingClientRect(data => {
				this.storeHeight = data.top;
				this.storeTop = data.top;
			}).exec();
		},
		methods: {
			// 授权回调
			onLoadFun() {
				this.isShowAuth = false
			},
			// 授权关闭
			authColse: function(e) {
				this.isShowAuth = e
			},
			// 打开授权			
			authOpen: function() {
				let that = this;
				if (that.isLogin === false) {
					// #ifdef H5 || APP-PLUS
					toLogin();
					// #endif
					// #ifdef MP
					that.$set(that, 'isAuto', true);
					that.$set(that, 'isShowAuth', true);
					// #endif
				}
			},
			// 领取优惠券
			receiveCoupon(item) {
				let that = this;
				if (that.isLogin === false) {
					// #ifdef H5 || APP-PLUS
					toLogin();
					// #endif
					// #ifdef MP
					that.$set(that, 'isAuto', true);
					that.$set(that, 'isShowAuth', true);
					// #endif
				} else {
					setCouponReceive(item.coupon_id).then(res => {
						item.issue = 1
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
					}).catch(err => {
						uni.showToast({
							title: err,
							icon: 'none'
						})
					})
				}

			},
			// 获取商品详情
			getStore: function() {
				console.log(this.id)
				getStoreDetail(this.id).then(res => {
					this.store = res.data;
					// #ifdef H5
					this.ShareInfo();
					// #endif
				}).catch(err => {
					this.loading = false;
					uni.showToast({
						title: err,
						icon: 'none'
					})
					setTimeout(function() {
						uni.navigateBack()
					}, 1000);
				})
			},
			// 获取商铺商品
			getGoods: function() {
				let that = this;
				if (that.loadend) return;
				if (that.loading) return;
				that.goodsLoading = true;
				that.loadTitle = '';
				getStoreGoods(that.id, that.where).then(res => {
					that.goodsLoading = false;
					let list = res.data.list;
					let goodsList = that.$util.SplitArray(list, that.goods);
					let loadend = list.length < that.where.limit;
					that.loadend = loadend;
					that.loading = false;
					that.loadTitle = loadend ? '已全部加载' : '加载更多';
					that.$set(that, 'goods', goodsList);
					that.$set(that.where, 'page', that.where.page + 1);
				}).catch(err => {
					that.loading = false;
					that.goodsLoading = false;
					uni.showToast({
						title: err,
						icon: 'none'
					})
					setTimeout(function() {
						uni.navigateBack()
					}, 1000);
				});
			},
			// 获取商铺分类
			getCategory: function() {
				if (this.category.length) {
					return;
				}
				this.categoryLoading = true;
				getStoreCategory(this.id).then(res => {
					this.categoryLoading = false;
					this.category = res.data;
				});
			},
			// 获取商铺优惠券
			getCoupon: function() {
				if (this.coupon.length) {
					return;
				}
				getShopCoupons(this.id).then(res => {
					this.coupon = res.data;
				});
			},
			// 关注商铺
			follow: function() {
				followStore(this.id).then(res => {
					if (res.status === 200) {
						this.store.care = true;
					}
					this.$util.Tips({
						title: res.message
					});
				});
			},
			// 取消关注
			unfollow: function() {
				unfollowStore(this.id).then(res => {
					if (res.status === 200) {
						this.store.care = false;
					}
					this.$util.Tips({
						title: res.message
					});
				});
			},
			// 设置是否关注
			followToggle: function() {
				this.store.care ? this.unfollow() : this.follow();
			},
			// 选择条件展示商品
			set_where: function(param) {
				this.select.show = false;
				this.loading = false;
				this.loadend = false;
				this.where.page = 1;
				this.goods = [];
				this.where.action = ""
				switch (param) {
					case 0:
						this.select.selected = 0;
						this.where.order = '';
						this.getGoods();
						break;
					case 1:
						this.select.selected = 1;
						this.where.order = 'rate';
						this.getGoods();
						break;
					case 2:
						this.navActive = 1;
						this.where.order = 'sales';
						this.getGoods();
						break;
					case 3:
						this.navActive = 2;
						this.sortPrice = !this.sortPrice;
						this.where.order = this.sortPrice ? 'price_asc' : 'price_desc';
						this.getGoods();
						break;
					case 4:
						this.navActive = 3;
						this.where.order = 'is_new';
						this.getGoods();
						break;
					case 5:
						this.navActive = 5;
						this.where.action = 1;
						this.where.order = ""
						this.getGoods();
						break;
				}
			},
			// 去分类商品页
			goCategoryGoods: function(id) {
				uni.navigateTo({
					url: `/pages/store/list/index?id=${id}&mer_id=${this.id}`
				})
			},
			// 去商品详情页
			goGoodsDetail(item) {
				goShopDetail(item, this.uid).then(res => {
					if (this.isLogin) {
						initiateAssistApi(item.activity_id).then(res => {
							let id = res.data.product_assist_set_id;
							uni.hideLoading();
							// #ifndef MP
							uni.navigateTo({
								url: '/pages/activity/assist_detail/index?id=' + id
							});
							// #endif
							// #ifdef MP
							openBargainSubscribe().then(res => {
								uni.hideLoading();
								uni.navigateTo({
									url: '/pages/activity/assist_detail/index?id=' + id
								});
							}).catch((err) => {
								uni.hideLoading();
							});
							// #endif					
						}).catch((err) => {
							uni.showToast({
								title: err,
								icon: 'none'
							})
						});
					} else {
						// #ifdef H5 || APP-PLUS
						toLogin();
						// #endif 
						// #ifdef MP
						this.isAuto = true;
						this.$set(this, 'isShowAuth', true);
						// #endif
					}
					
				})

			},
			// 商铺首页滚动 navbar 吸顶
			scrollHome: function(e) {
				this.navShow = e.detail.scrollTop >= this.storeHeight;
			},
			goback: function() {
				uni.navigateBack();
			},
			// 首页
			goHome() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			},
			// 商铺底部切换
			tab: function(param) {
				this.tabActive = param;
			},
			//#ifdef H5
			ShareInfo() {
				let data = this.store;
				let href = location.href;
				if (this.$wechat.isWeixin()) {
					getUserInfo().then(res => {
						href =
							href.indexOf("?") === -1 ?
							href + "?spid=" + res.data.uid :
							href + "&spid=" + res.data.uid;

						let configAppMessage = {
							desc: data.mer_info,
							title: data.mer_name,
							link: href,
							imgUrl: data.mer_avatar
						};

						this.$wechat.wechatEvevt([
							"updateAppMessageShareData",
							"updateTimelineShareData",
							"onMenuShareAppMessage",
							"onMenuShareTimeline"
						], configAppMessage).then(res => {
							console.log(res, '=============================>>WXAPI');
						}).catch(err => {
							console.log(err);
						})
					});
				}
			},
			//#endif
		}
	}
</script>

<style lang="scss">
	.u-swiper{
	}
	.float {
		position: fixed;
		right: 30rpx;
		bottom: 80rpx;
		image {
			width: 80rpx;
			height: 80rpx;
		}
	}
	.fwfw {
		background: #f5f5f5 !important;
		color: #999999;
	}
	.fff {
		background-color: #ffffff !important;
		color: #000000 !important;
	}
	.f5f5{
		background-color: f5f5f5;
		color: #000000;
	}
	.content {
		display: flex;
		text-align: center;
		padding-top: 40rpx;
		.weix {
			display: flex;
			flex-direction: column;
			justify-content: center;
			flex: 1;
		}
		.haib {
			display: flex;
			flex-direction: column;
			justify-content: center;
			flex: 1;
		}
	}
	.guarantee {
		display: flex;
		.item {
			flex: 1;
			height: 148rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			background-color: #ffffff;
			image {
				width: 44rpx;
				height: 44rpx;
				display: inline-block;
				margin-bottom: 20rpx;
			}
			.text {
				font-size: 24rpx;
				color: #222222;
			}
		}
	}
	.recommend {
		background-color: #ffffff;
		padding: 30rpx;
		.top {
			display: flex;
			flex-direction: column;
			margin-bottom: 40rpx;
			.title {
				text-align: center;
				font-size: 34rpx;
				font-weight: 700;
				color: #222222;
				margin-bottom: 13rpx;
			}
			.subtitle {
				display: flex;
				justify-content: center;
				align-items: center;
				text {
					font-size: 24rpx;
					color: #222;
					padding: 0 17rpx;
				}
				span {
					width: 88rpx;
					border: 1rpx solid #bdbdbd;
				}
			}
		}
		.recommend-goods {
			display: flex;
			flex-wrap: nowrap;
			.item:nth-child(2) {
				margin: 0 17rpx;
			}
			.item {
				width: 219rpx;
				image {
					width: 219rpx;
					height: 219rpx;
					border-radius: 8rpx;
					margin-bottom: 16rpx;
				}
				.name {
					text-overflow: -o-ellipsis-lastline;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					font-size: 26rpx;
					color: #333;
					font-weight: bold;
					padding: 16rpx 0 4rpx 0;
				}
				.price {
					font-size: 24rpx;
					font-weight: bold;
					color: #db4234;
				}
			}
		}
	}
	/deep/ .care {
		background-image: none !important;
		border: 1px solid #fff;
		background-color: #F5F5F5;
		color: #000000 !important;
	}

	.store-home {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		padding-bottom: 100rpx;
		background: left top/750rpx 360rpx no-repeat fixed;
		overflow: hidden;
	}
	.header {
		position: relative;
		z-index: 6;
		display: flex;
		align-items: center;
		padding-right: 34rpx;
		height: 86rpx;
		padding-left: 33rpx;

		.head-menu {
			display: -webkit-box;
			display: -webkit-flex;
			display: flex;
			-webkit-box-align: center;
			-webkit-align-items: center;
			align-items: center;
			height: 27px;
			width: 70px;
			background: rgba(0, 0, 0, 0.25);
			border-radius: 13px;

			.icon-xiangzuo {
				font-size: 32rpx;
				color: #FFFFFF;
			}

			.iconfont {
				-webkit-box-flex: 1;
				-webkit-flex: 1;
				flex: 1;
				text-align: center;
				color: #fff;
				box-sizing: border-box;

				&.icon-xiangzuo {
					border-right: 1px solid #fff;
				}
			}
		}


		.search {
			flex: 1;
			display: flex;
			align-items: center;
			min-width: 0;
			height: 58rpx;
			border-radius: 29rpx;
			margin-left: 32rpx;
			background-color: #FFFFFF;
			font-weight: 500;
			font-size: 26rpx;
			color: #999999;

			.iconfont {
				margin-right: 13rpx;
				margin-left: 30rpx;
				font-size: 24rpx;
			}
		}
	}

	.main {
		flex: 1;
		min-height: 0rpx;
	}

	.store {
		position: relative;
		z-index: 6;
		display: flex;
		align-items: center;
		padding-right: 20rpx;
		padding-left: 20rpx;
		padding-top: 20rpx;
		padding-bottom: 22rpx;
		color: #FFFFFF;
		image {
			width: 74rpx;
			height: 74rpx;
			border-radius: 6rpx;
		}

		.text {
			flex: 1;
			min-width: 0;
			margin-right: 20rpx;
			margin-left: 20rpx;

			navigator {
				display: inline-flex;
				align-items: center;
				max-width: 100%;

				.name {
					flex: 1;
					min-width: 0;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-weight: bold;
					font-size: 30rpx;
					line-height: 1;
				}

				.iconfont {
					margin-left: 10rpx;
					font-size: 17rpx;
					color: #FFFFFF;
				}
			}

			.score {
				display: flex;
				align-items: center;
				margin-top: 17rpx;
				font-weight: 500;
				font-size: 24rpx;
				line-height: 1;
				color: #FFFFFF;

				.star {
					position: relative;
					width: 111rpx;
					height: 19rpx;
					margin-right: 10rpx;
					background: url(../../columnGoods/images/star.png) left top/100% 100% no-repeat;
					overflow: hidden;

					view {
						position: absolute;
						top: 0;
						left: 0;
						width: 100%;
						height: 100%;
						background: url(../../columnGoods/images/star_active.png) left top/111rpx 19rpx no-repeat;
					}
				}
			}
		}

		button {
			display: flex;
			justify-content: center;
			align-items: center;
			width: 113rpx;
			height: 48rpx;
			border-radius: 24rpx;
			background-image: linear-gradient(-90deg, rgba(246, 122, 56, 1) 0%, rgba(241, 27, 9, 1) 100%);
			font-weight: 500;
			font-size: 22rpx;
			color: #FFFFFF;

			.iconfont {
				margin-right: 6rpx;
				font-size: 22rpx;
			}

			&.gary {
				background-color: #999;
			}
		}
	}

	.nav.fixed {
		position: fixed;
		left: 0;
		width: 100%;

		.nav-cont {
			position: absolute;
			width: 100%;
		}
	}

	.nav {
		width: 100%;
		position: fixed;
		z-index: 999;
		top: 0;
		left: 0;
		background: linear-gradient(top, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
		.nav-cont {
			display: flex;
			align-items: center;
			height: 84rpx;
			color: #ffffff;
			.item {
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				min-width: 0;
				height: 60rpx;
				.navigator {
					width: 138rpx;
					height: 60rpx;
					border-radius: 30rpx;
					font-size: 28rpx;
					text-align: center;
					line-height: 60rpx;
					background-color: rgba(255, 255, 255, 0.3);
				}
				.cont {
					display: flex;
					justify-content: center;
					align-items: center;
					height: 60rpx;
					font-weight: 500;
					font-size: 24rpx;
					font-weight: bold;

					.arrow-icon {
						margin-left: 10rpx;
						font-size: 18rpx;
					}

					.layout-icon {
						font-size: 32rpx;
					}

					.icon-pailie {
						font-size: 32rpx;
					}

					image {
						width: 15rpx;
						height: 21rpx;
						margin-left: 7rpx;
					}
				}
			}

			.active {
				.cont {
					border-bottom: 7rpx solid #e93323;
				}
			}
		}

		.select {
			position: absolute;
			top: 100%;
			left: 0;
			z-index: 2;
			width: 100%;
			padding-right: 40rpx;
			padding-bottom: 28rpx;
			padding-left: 74rpx;
			border-bottom-right-radius: 24rpx;
			border-bottom-left-radius: 24rpx;
			background-color: #FFFFFF;

			.item {
				margin-top: 28rpx;
				font-size: 24rpx;
				color: #454545;
			}

			.active {
				background: url(../../../static/images/active.png) right center/20rpx no-repeat;
				color: #E93323;
			}
		}
	}
	.goods-wrap {
		background-color: #f5f5f5;
		.top {
			display: flex;
			flex-direction: column;
			padding-bottom: 40rpx;
			.title {
				text-align: center;
				font-size: 34rpx;
				font-weight: 700;
				color: #222222;
				padding-bottom: 13rpx;
			}
			.subtitle {
				display: flex;
				justify-content: center;
				align-items: center;
				text {
					font-size: 24rpx;
					color: #222;
					padding: 0 17rpx;
				}
				span {
					width: 88rpx;
					border: 1rpx solid #bdbdbd;
				}
			}
		}
	}
	.goods {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding-top: 20rpx;
		padding-right: 20rpx;
		padding-left: 20rpx;
		background-color: #F5F5F5;
		width: 750rpx;

		.item {
			width: 345rpx;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			background-color: #FFFFFF;
			overflow: hidden;

			.image {
				width: 345rpx;
				height: 345rpx;

				image {
					display: block;
					width: 100%;
					height: 100%;
				}
			}

			.text {
				padding: 20rpx 20rpx 25rpx;

				.name {
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-weight: 500;
					font-size: 30rpx;
					line-height: 1;
					color: #222222;
				}

				.money-wrap {
					display: flex;
					align-items: center;
					margin-top: 43rpx;

					.money {
						font-weight: bold;
						font-size: 26rpx;
						color: $theme-color;

						text {
							font-size: 34rpx;
							line-height: 1;
						}
					}

					.ticket {
						height: 26rpx;
						padding-right: 9rpx;
						padding-left: 9rpx;
						border: 1rpx solid $theme-color;
						border-radius: 4rpx;
						margin-left: 10rpx;
						font-weight: 500;
						font-size: 20rpx;
						line-height: 24rpx;
						color: $theme-color;
					}
				}

				.score {
					margin-top: 20rpx;
					font-weight: 500;
					font-size: 20rpx;
					line-height: 1;
					color: #737373;
				}
			}

			.foot {
				display: flex;
				justify-content: center;
				align-items: center;
				height: 52rpx;
				background: linear-gradient(to right, #F11B09, #F67A38);
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;

				.iconfont {
					margin-right: 10rpx;
					font-size: 22rpx;
					line-height: 1;
				}
			}
		}
	}

	.column {
		padding: 0;
		background-color: #FFFFFF;

		.item {
			position: relative;
			display: flex;
			align-items: center;
			width: 100%;
			padding: 30rpx 20rpx;
			border-radius: 0;
			margin-bottom: 0;

			&::before {
				content: " ";
				position: absolute;
				top: 0;
				right: 20rpx;
				left: 250rpx;
				border-top: 1rpx solid #F5F5F5;
			}

			.image {
				width: 200rpx;
				height: 200rpx;
				border-radius: 16rpx;
				overflow: hidden;
			}

			.text {
				position: relative;
				flex: 1;
				min-width: 0;
				padding-top: 0;
				padding-right: 0;
				padding-bottom: 0;

				.name {
					color: #282828;
				}

				.money-wrap {
					display: flex;
					flex-direction: column;
					align-items: flex-start;
					margin-top: 52rpx;

					.ticket {
						height: 28rpx;
						padding-right: 12rpx;
						padding-left: 12rpx;
						border: none;
						border-radius: 0;
						margin-top: 17rpx;
						margin-left: 0;
						background: url(../../../static/images/yh.png) top left/100% 100% no-repeat;
						line-height: 28rpx;
					}
				}
			}

			.foot {
				position: absolute;
				right: 20rpx;
				bottom: 30rpx;
				height: 44rpx;
				padding-right: 17rpx;
				padding-left: 17rpx;
				border-radius: 22rpx;
				font-size: 22rpx;
				color: #F5F5F5;
			}
		}
	}

	.category {
		padding-top: 34rpx;
		padding-right: 20rpx;
		padding-left: 20rpx;

		.section {
			border-radius: 10rpx;
			margin-bottom: 20rpx;
			background-color: #FFFFFF;

			.head {
				position: relative;
				display: flex;
				align-items: center;
				height: 90rpx;
				padding-right: 20rpx;
				padding-left: 36rpx;
				font-weight: bold;
				color: #282828;

				&::before {
					content: " ";
					position: absolute;
					top: 50%;
					left: 20rpx;
					width: 6rpx;
					height: 24rpx;
					background-color: $theme-color;
					transform: translateY(-50%);
				}

				.title {
					flex: 1;
					min-width: 0;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-size: 30rpx;
				}

				.iconfont {
					font-size: 22rpx;
					line-height: 1;
				}
			}

			.body {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				align-items: center;
				padding: 9rpx 36rpx 14rpx;

				.item {
					width: 314rpx;
					height: 84rpx;
					padding-right: 30rpx;
					padding-left: 30rpx;
					border-radius: 10rpx;
					background-color: #F5F5F5;
					margin-bottom: 10rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-weight: 500;
					font-size: 26rpx;
					line-height: 84rpx;
					color: #282828;
				}
			}
		}
	}

	.coupon {
		padding: 30rpx;
		margin-top: 34rpx;
		background-color: #F5F5F5;

		.item {
			display: flex;
			margin-bottom: 16rpx;

			.left {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				width: 240rpx;
				background: url(../static/images/coupon1.png) left top/100% 100% no-repeat;
				font-weight: 500;
				font-size: 24rpx;
				line-height: 1;
				color: #FFFFFF;

				&.gary {
					background-image: url('');
				}

				.money {
					margin-bottom: 25rpx;
					font-weight: 800;
					font-size: 36rpx;

					text {
						margin-left: 10rpx;
						font-size: 60rpx;
					}
				}
			}

			.right {
				flex: 1;
				min-width: 0;
				padding-right: 18rpx;
				padding-left: 27rpx;
				background-color: #FFFFFF;

				.name {
					padding-top: 32rpx;
					padding-bottom: 32rpx;
					border-bottom: 1rpx solid #F0F0F0;
					font-weight: 500;
					font-size: 30;
					line-height: 1;
					color: #282828;

					text {
						display: inline-block;
						width: 84rpx;
						height: 28rpx;
						border: 1rpx solid $theme-color;
						border-radius: 14rpx;
						margin-right: 15rpx;
						background-color: #FFF4F3;
						font-weight: 500;
						font-size: 20rpx;
						line-height: 26rpx;
						text-align: center;
						color: $theme-color;

						&.gary {
							border-color: #BBB;
							color: #bbb;
							background-color: #F5F5F5;
						}
					}
				}

				.time-wrap {
					display: flex;
					align-items: center;
					padding-top: 16rpx;
					padding-bottom: 16rpx;
					font-weight: 500;
					font-size: 20rpx;
					color: #999999;

					.time {
						flex: 1;
						min-width: 0;
					}

					.button {
						width: 136rpx;
						height: 44rpx;
						border-radius: 22rpx;
						background-color: $theme-color;
						font-weight: 500;
						font-size: 22rpx;
						line-height: 44rpx;
						text-align: center;
						color: #FFFFFF;

						&.gary {
							background-color: #999;
						}
					}
				}
			}
		}

		.disabled {
			.left {
				background-image: url(../static/images/coupon2.png);
			}

			.right {
				.name {
					text {
						border-color: #C1C1C1;
						color: #C1C1C1;
					}
				}

				.time-wrap {
					.button {
						background-color: #CCCCCC;
						color: #FFFFFF;
					}
				}
			}
		}
	}

	.footer {
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 5;
		display: flex;
		width: 100%;
		height: 100rpx;
		background-color: #FFFFFF;
		opacity: 0.96;

		.item {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-weight: 500;
			font-size: 20rpx;
			color: #282828;

			.iconfont {
				font-size: 43rpx;
			}
		}

		.active {
			color: $theme-color;
		}
	}
</style>
